package ckf.man.practice.controller;

import ckf.man.practice.entity.Equipment;
import ckf.man.practice.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/equipment")
public class EquipmentController {
    @Autowired
    private EquipmentService equipmentService;

    @GetMapping("/get")
    public List<Equipment> get() {
        return equipmentService.list();
    }

    @PostMapping("/getByIds")
    public List<Equipment> getByIds(@RequestBody Map<String,List<Integer>> ids) {
        return equipmentService.listByIds(ids.get("list"));
    }

    @PostMapping("/getById")
    public Equipment getById(@RequestBody Map<String,Integer> id) {
        return equipmentService.getById(id.get("id"));
    }

}
